<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <link rel="apple-touch-icon" sizes="76x76" href="{_INDEX_STATIC_}/moban/assets/img/apple-icon.png">
    <link rel="icon" type="image/png" href="{_INDEX_STATIC_}/moban/assets/img/favicon.png">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>首页 | {$system_name}</title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
        name='viewport' />
    <link href="{_INDEX_STATIC_}/moban/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="{_INDEX_STATIC_}/moban/assets/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
</head>

<body class="index-page sidebar-collapse">

    <!-- 引入导航栏 -->
    {include file='public/header'}

    <div class="container" style="min-height: 410px;">
        <div class="row" style="margin-top: 80px;">
            <!-- 昵称 年龄 Start -->
            <div class="col-md-1"></div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        昵称
                    </span>
                    <input id="name" type="text" class="form-control" placeholder="请输入昵称"
                        value="{$user_info_data.name}">
                </div>
            </div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        年龄
                    </span>
                    <input id="age" type="number" class="form-control" placeholder="请输入年龄" value="{$user_info_data.age}">
                </div>
            </div>
            <div class="col-md-1"></div>
            <!-- 昵称 年龄 End -->


            <!-- 职务 手机 Start -->
            <div class="col-md-1"></div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        职务
                    </span>
                    <input id="position" type="text" class="form-control" placeholder="请输入职务"
                        value="{$user_info_data.position}">
                </div>
            </div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        手机
                    </span>
                    <input id="phone" type="number" class="form-control" placeholder="请输入手机"
                        value="{$user_info_data.phone}">
                </div>
            </div>
            <div class="col-md-1"></div>
            <!-- 职务 手机 End -->

            <!-- 邮箱 QQ Start -->
            <div class="col-md-1"></div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        邮箱
                    </span>
                    <input id="email" type="text" class="form-control" placeholder="请输入邮箱"
                        value="{$user_info_data.email}">
                </div>
            </div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        QQ
                    </span>
                    <input id="qq" type="number" class="form-control" placeholder="请输入QQ" value="{$user_info_data.qq}">
                </div>
            </div>
            <div class="col-md-1"></div>
            <!-- 邮箱 QQ End -->

            <!-- 办公室电话 微信 Start -->
            <div class="col-md-1"></div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        办公室电话
                    </span>
                    <input id="tel" type="text" class="form-control" placeholder="请输入办公室电话"
                        value="{$user_info_data.tel}">
                </div>
            </div>
            <div class="col-md-5">
                <div class="input-group">
                    <span class="input-group-addon">
                        微信
                    </span>
                    <input id="wx" type="text" class="form-control" placeholder="请输入微信" value="{$user_info_data.wx}">
                </div>
            </div>
            <div class="col-md-1"></div>
            <!-- 办公室电话 微信 End -->

            <!-- 办公室地址 Start -->
            <div class="col-md-1"></div>
            <div class="col-md-10">
                <div class="input-group">
                    <span class="input-group-addon">
                        办公室地址
                    </span>
                    <input id="address" type="text" class="form-control" placeholder="请输入办公室地址"
                        value="{$user_info_data.address}">
                </div>
            </div>
            <div class="col-md-1"></div>
            <!-- 办公室地址 End -->
            
            <div class="col-md-6" style="text-align: center;">
                <button id="save" class="btn btn-success btn-round btn-lg">点击修改</button>
            </div>
            <div class="col-md-6" style="text-align: center;">
                <button id="back" class="btn btn-info btn-round btn-lg">点击返回</button>
            </div>

        </div>
    </div>
    <!-- 引入页脚 -->
    {include file='public/footer'}

    <script>

        // 点击保存
        $('#save').on('click',function(){
            // 收集数据
            var id = "{$user_info_data.id}";
            var name = $('#name').val().trim();
            var age = $('#age').val().trim();
            var position = $('#position').val().trim();
            var phone = $('#phone').val().trim();
            var email = $('#email').val().trim();
            var qq = $('#qq').val().trim();
            var tel= $('#tel').val().trim();
            var wx= $('#wx').val().trim();
            var address= $('#address').val().trim();

            var data = {
                'id':id,
                'name':name,
                'age':age,
                'position':position,
                'phone':phone,
                'email':email,
                'qq':qq,
                'tel':tel,
                'wx':wx,
                'address':address,
            };

            $.ajax({
                url: "{:url('User/user_edit')}",
                data: data,
                type: "POST",
                dataType: "JSON",
                success: function (res) {
                    // 返回结果处理
                    if (res.code == 0) {
                        return layer.msg(res.msg, { icon: 1, time: 900 });
                    } else {
                        return layer.msg(res.msg, { icon: 2, time: 900 });
                    }
                }
            });
        }); 

        // 点击返回
        $('#back').on('click',function(){
            window.location.href=document.referrer;
        });

    </script>


</body>

</html>